//
//  PKRadioHostessWorksCollectionViewController.m
//  PianKe
//
//  Created by lanou on 15/10/7.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "PKRadioHostessWorksCollectionViewController.h"
#import "PKRadioWorksCollectionViewCell.h"
@interface PKRadioHostessWorksCollectionViewController ()

@end

@implementation PKRadioHostessWorksCollectionViewController

static NSString * const reuseIdentifier = @"PKRadioWorksCollectionViewCell.h";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Register cell classes

    [self.collectionView registerClass:[PKRadioWorksCollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma mark <UICollectionViewDataSource>

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
#warning Incomplete method implementation -- Return the number of sections
    return 1;
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
#warning Incomplete method implementation -- Return the number of items in the section
    
    if (self.datasourceArr.count>6) {
        return 6;
    }
    else
    {
        return self.datasourceArr.count;

    }
    }

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    PKRadioWorksCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    
    // Configure the cell
    
    PKMainLessonMoreting *moretingModel=self.datasourceArr[indexPath.item];
    cell.moretingModel=moretingModel;
    return cell;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(100, 120);
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 10;
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout
{
    return 10;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
//    PKRadioWorksCollectionViewCell * cell=(PKRadioWorksCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
    
    //获取当前显示的cell;
//    collectionView.visibleCells
//    UITapGestureRecognizer *tapRecognized=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickItemPlayer:)];
//        [cell.pictureImag addGestureRecognizer:tapRecognized];
//    cell.pictureImag.tag=indexPath.row+1000;
//        cell.pictureImag.userInteractionEnabled=YES;


    NSString *tingid=((PKMainLessonMoreting *)self.datasourceArr[indexPath.row]).tingid;
    if (self.ScucessClickCollectionItemBlcok!=nil) {
        self.ScucessClickCollectionItemBlcok(tingid,indexPath.item);
    };
    
}
//-(void)clickItemPlayer:(UITapGestureRecognizer *)taprecognized
//{
//    NSInteger count=taprecognized.view.tag-1000;

//    }
    

//}
#pragma mark <UICollectionViewDelegate>

/*
// Uncomment this method to specify if the specified item should be highlighted during tracking
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath {
	return YES;
}
*/

/*
// Uncomment this method to specify if the specified item should be selected
- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}
*/

/*
// Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item
- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath {
	return NO;
}

- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
	return NO;
}

- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
	
}
*/

@end
